<?php
namespace app\app\util;
use think\cache\driver\Redis;
use think\Request;

// 登陆用户id前缀
define('SID_VICT', 'wc:vict:id:');

class FightUtils{

    public static function setUserVict($user_id,$user_id,$overdatetime){
        $redis = new Redis(['host'=>config('REDIS_HOST'),'password'=>config('REDIS_AUTH')]);
        $redis->set(SID_VICT.$user_id,$user_id,$overdatetime);
        return true;
    }

    public static function getUserVict($user_id){
        $redis = new Redis(['host'=>config('REDIS_HOST'),'password'=>config('REDIS_AUTH')]);
        if($redis->has(SID_VICT.$user_id)){
            return $redis->get(SID_VICT.$user_id);
        }else{
            return false;
        }
    }
}
